﻿

$(document).ready(function () {
    App.TimerFunArray.push(App.ajaxAtWho);
    App.StartTimer();
    App.bindGoTop(curBorder);
});


var follow = function (id, name, alink) {
    if (alink.locked)
        return;
    alink.locked = true;

    App.FollowOne(id, name, function (ID, Name, O) {
        if (O.Data == 1) {
            $('<div class="MIB_btn_inter lf">互相关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent());
            $(alink).parent().remove();
        }
        if (O.Data == 2) {
            $('<div class="MIB_btn2 lf">已关注<span class="MIB_line_sp">|</span><a onclick="cancelFollow(' + ID + ',\'' + Name + '\',this);return false;" href="javascript:void(0)" class="MIB_linkbl"><em>取消</em></a></div>').insertAfter($(alink).parent());
            $(alink).parent().remove();
        }
        $("#more_handle").fadeIn();
        $("#remark_name").fadeIn();
    }, function () { alink.locked = false; });
};
var cancelFollow = function (id, name, alink) {
    if (alink.locked)
        return;
    App.miniConfirm("是否取消关注" + name, alink, function () {

        alink.locked = true;
        App.CancelFollow(id, function (ID, O) {
            if (O.Data == 3) {
                $('<div class="lf"><a class="btn_add" onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0)"><img src="/Content/Image/transparent.gif" alt="" title="已关注你" class="ico_addGrn"><em><img src="/Content/Image/transparent.gif" alt="" class="SG_icon add_icoz">&nbsp;加关注</em></a></div>').insertAfter($(alink).parent());
                $(alink).parent().remove();
            }
            if (O.Data == 4) {
                $('<div class="lf"><a onclick="follow(' + ID + ',\'' + name + '\',this);return false;" href="javascript:void(0);" class="btn_add"><img class="SG_icon" src="/Content/Image/transparent.gif" title="关注"><em>加关注</em></a></div>').insertAfter($(alink).parent());
                $(alink).parent().remove();
            }
            $("#more_handle").fadeOut();
            $("#remark_name").fadeOut();
        }, function () { alink.locked = false; });
    });

};
  